import re

UPPERCASE_LETTER_PATTERN = re.compile(r'^[A-Z][A-Z]*$')
UPPERCASE_LETTER_FOLLOWED_BY_DIGIT_PATTERN = re.compile(r'^[A-Z][A-Z]*\d\d*$')

def isUppercaseLetter(cell):
    if cell is None or cell.value is None:
        return False
    return UPPERCASE_LETTER_PATTERN.match(str(cell.value))

def isUppercaseLetterFollowedByDigit(cell):
    if cell is None or cell.value is None:
        return False
    return UPPERCASE_LETTER_FOLLOWED_BY_DIGIT_PATTERN.match(str(cell.value))

# 是否是纯的引用，这种模式应用于，行通过拆分键识别，列通过模板的列字母识别
def isPureAlphaPlaceholder(cell):
    if cell is None or cell.value is None:
        return False
    if cell.value.isalpha() and cell.value.isupper():
        return True
    return False


# 是否是纯的引用，这种模式应用于行和列均有单元格模板识别，相当于是写死的
def isAlphaDigitPlaceholder(cell):
    if cell is None or cell.value is None:
        return False
    if isUppercaseLetterFollowedByDigit(cell):
        return True
    return False